/*
* Copyright 2010 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Iesi.Collections.Generic;

namespace Ngilead.Test.Models.Stateless
{

    
    /// <summary>
    /// User
    /// </summary>
    [DataContract]
    [KnownType(typeof(HashedSet<Message>))]
    public class User : AbstractPersistentObject<Int64>, IUser
    {
        #region Private

        private String _login;
        private String _firstName;
        private String _lastName;
        private String _password;
        private Address _address;
        private Gender _gender;
        private ISet<Message> _messageList;
        private IList<Group> _groupList;

        #endregion

        #region Public

        /// <summary>
        /// Login 
        /// </summary>
        [DataMember]
        public virtual String Login
        {
            get { return _login; }
            set { _login = value; }
        }

        /// <summary>
        /// FirstName
        /// </summary>
        [DataMember]
        public virtual String FirstName
        {
            get { return _firstName; }
            set { _firstName = value; }
        }

        /// <summary>
        /// LastName
        /// </summary>
        [DataMember]
        public virtual String LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }

        /// <summary>
        /// Password
        /// </summary>
        [DataMember]
        public virtual String Password
        {
            get { return _password; }
            set { _password = value; }
        }

        /// <summary>
        /// Address
        /// </summary>
        [DataMember]
        public virtual Address Address
        {
            get { return _address; }
            set { _address = value; }
        }

        /// <summary>
        /// Gender 
        /// </summary>
        [DataMember]
        public virtual Gender Gender
        {
            get { return _gender; }
            set { _gender = value; }
        }

        /// <summary>
        /// Message list
        /// </summary>
        [DataMember]
        public virtual ISet<Message> MessageList
        {
            get { return _messageList; }
            set { _messageList = value; }
        }

        /// <summary>
        /// Group list
        /// </summary>
        [DataMember]
        public virtual IList<Group> GroupList
        {
            get { return _groupList; }
            set { _groupList = value; }
        }

        #endregion

        #region Override

        /// <summary>
        /// Override ToString()
        /// </summary>
        /// <returns>String</returns>
        public override string ToString()
        {
            return String.Format("{0} {1} ({2}) [id {3} / version {4}]", FirstName, LastName, Login, Id, Version);
        }

        #endregion
    }
}